var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var Animal = /** @class */ (function () {
    function Animal(name) {
        this.name = name;
    }
    Animal.prototype.move = function (distanceInMeters) {
        if (distanceInMeters === void 0) { distanceInMeters = 0; }
        console.log("".concat(this.name, " moved ").concat(distanceInMeters, "m."));
    };
    return Animal;
}());
var Snake = /** @class */ (function (_super) {
    __extends(Snake, _super);
    function Snake(name) {
        return _super.call(this, name) || this;
    }
    Snake.prototype.jump = function (num) {
        console.log("Jumping...");
        _super.prototype.move.call(this, num); //调用父类的方法，必须使用super关键字，否则会报错
    };
    return Snake;
}(Animal));
var sam = new Snake("Sammy the Python");
sam.jump(10); //Jumping...
// sam.move(); //报错，因为move方法是protected，只能在子类中调用
var Dog = /** @class */ (function (_super) {
    __extends(Dog, _super);
    function Dog(name) {
        return _super.call(this, name) || this;
    }
    Dog.prototype.jump = function (num) {
        console.log("Jumping...");
        _super.prototype.move.call(this, num); //调用父类的方法，必须使用super关键字，否则会报错
        this.slimp(); //调用子类的方法，不需要使用super关键字，但是必须在子类中定义，否则会报错
    };
    Dog.prototype.slimp = function () {
        console.log("Slimping...");
    };
    return Dog;
}(Animal));
var Horse = /** @class */ (function (_super) {
    __extends(Horse, _super);
    function Horse() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    return Horse;
}(Dog));
var horse = new Horse("Tommy the Palomino");
horse.jump(10); //Jumping...
// horse.slimp(); //报错，因为slimp方法是private，只能在子类中调用
